<include file="Public/header"/>
<div class="layui-tab">
<ul class="layui-tab-title">
    <li class="" data-url="<{:U('User/editUser',array('uid'=>$_GET['uid']))}>" onclick="load_url(this)">商户信息</li>
    <li class="layui-this" data-url="<{:U('User/userWithdrawal',array('uid'=>$_GET['uid']))}>" onclick="load_url(this)">提现</li>
    <li class="" data-url="<{:U('User/editUserProduct',array('uid'=>$_GET['uid']))}>" onclick="load_url(this)">通道</li>
    <li class="" data-url="<{:U('User/userRateEdit',array('uid'=>$_GET['uid']))}>" onclick="load_url(this)">费率</li>
</ul>
<div class="layui-tab-content">
    <div class="layui-tab-item layui-show">
        <form class="layui-form" action="" id="profile">
            <input type="hidden" name="userid" value="<{$_GET['uid']}>">
            <input type="hidden" name="id" value="<{$u['id']}>">
            <div class="layui-form-item">
                <label class="layui-form-label">应用规则：</label>
                <div class="layui-input-block">
                    <input type="radio" name="u[systemxz]" lay-filter="changeRule" <if condition="$u[systemxz] eq 0">checked</if>
                    value="0" title="系统规则">
                    <input type="radio" name="u[systemxz]" lay-filter="changeRule" <if condition="$u[systemxz] eq 1">checked</if>
                    value="1" title="个人规则">
                </div>
            </div>
            
            <div class="changeRule" id="changeRule" style="display:<if condition=" !$u[systemxz]
            ">none</if>;">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">单笔最小金额：</label>
                        <div class="layui-input-inline">
                            <input type="number" min="0" name="u[tkzxmoney]" autocomplete="off" value="<{$u.tkzxmoney}>" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">单笔最大金额：</label>
                        <div class="layui-input-inline">
                            <input type="number" min="0" name="u[tkzdmoney]" autocomplete="off" value="<{$u.tkzdmoney}>" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">当日总金额：</label>
                        <div class="layui-input-inline">
                            <input type="number" min="0" name="u[dayzdmoney]" autocomplete="off" value="<{$u.dayzdmoney}>" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">当日总次数：</label>
                        <div class="layui-input-inline">
                            <input type="number" min="0" name="u[dayzdnum]" autocomplete="off" value="<{$u.dayzdnum}>" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">购买T+0金额：</label>
                        <div class="layui-input-inline">
                            <input type="number" min="0" name="u[gmt0]" autocomplete="off" value="<{$u.gmt0}>" placeholder="0.00" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">手续费类型：</label>
                        <div class="layui-input-inline">
                            <select name="u[tktype]" lay-verify="required" lay-search="">
                                <option value=""></option>
                                <option <if condition="$u['tktype'] eq 0">selected</if> value="0">按比例计算</option>
                                <option <if condition="$u['tktype'] eq 1">selected</if> value="1">按单笔计算</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">单笔提款比例：</label>
                        <div class="layui-input-inline">
                            <input type="number" min="0" step="0.1" name="u[sxfrate]" autocomplete="off" value="<{$u.sxfrate}>" placeholder="%" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">单笔提款收取：</label>
                        <div class="layui-input-inline">
                            <input type="number" min="0" name="u[sxffixed]" autocomplete="off" value="<{$u.sxffixed}>" placeholder="0.00" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">结算方式：</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="u[t1zt]" <if condition="$u[t1zt] eq 0">checked</if> value="0" title="T+0"
                            checked="">
                            <input type="radio" name="u[t1zt]" <if condition="$u[t1zt] eq 1">checked</if> value="1" title="T+1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">提款状态：</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="u[tkzt]" <if condition="$u[tkzt] eq 0">checked</if> value="0" title="关闭" checked="">
                            <input type="radio" name="u[tkzt]" <if condition="$u[tkzt] eq 1">checked</if> value="1" title="开通">
                        </div>
                    </div>
                </div>
        </form>

        
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label"></label>
            <button class="btn btn-primary" lay-submit="submit" lay-filter="save">提交保存</button>
        </div>
    </div>
</div>
</div>
</div>
</form>
<script src="/Public/Front/js/jquery.min.js"></script>
<script src="/Public/Front/js/bootstrap.min.js"></script>
<script src="/Public/Front/js/plugins/peity/jquery.peity.min.js"></script>
<script src="/Public/Front/js/content.js"></script>
<script src="/Public/Front/js/plugins/layui/layui.js" charset="utf-8"></script>
<script>
    layui.use(['layer', 'form', 'laydate'], function () {
        var form = layui.form
            , laydate = layui.laydate
            , layer = layui.layer;

        //常规用法
        laydate.render({
            elem: '#birthday'
        });
        //监听radio
        form.on('radio(changeRule)', function (data) {
            // console.log(data.elem); //得到radio原始DOM对象
            //console.log(data.value); //被点击的radio的value值
            if (data.value == 1) {
                $('#changeRule').css('display', '');
            } else if (data.value == 0) {
                $('#changeRule').css('display', 'none');
            }
        });
        //监听提交
        form.on('submit(save)', function (data) {
            $.ajax({
                url: "<{:U('User/saveUser')}>",
                type: "post",
                data: $('#profile').serialize(),
                success: function (res) {
                    if (res.status) {
                        layer.alert("编辑成功", {icon: 6}, function () {
                            parent.location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                    } else {
                        layer.alert("操作失败:" + res.msg, {icon: 5}, function (index) {
                            layer.close(index)
                        });
                    }
                }
            });
            return false;
        });
    });

    function load_url(url) {
        var url = $(url).data('url');
        location.href = url;
    }

</script>
</body>
</html>
